/// @coding utf-8
/// @author errorcpp@qq.com

package main

import (
	"fmt"

	"github.com/shirou/gopsutil/host"
)

// temps, err := cpu.Temperature()
// if err != nil {
// 	fmt.Printf("Failed to read CPU temperature: %v", err)
// 	return
// }

// for _, temp := range temps {
// 	fmt.Printf("CPU温度: %.2f°C\n", temp)
// }

func main() {
	sensors, err := host.SensorsTemperatures()
	if err != nil {
		fmt.Println("获取CPU温度失败：", err)
		return
	}

	for _, sensor := range sensors {
		fmt.Printf("传感器：%s\t温度：%.2f℃\n", sensor.SensorKey, sensor.Temperature)
	}
}
